package cn.ym.ymcc.fallback;

import cn.ym.ymcc.domain.User;
import cn.ym.ymcc.feign.UserFeignClient;
import cn.ym.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/*
 * @Description: 熔断托底方法
 * @param throwable:
 * @return: cn.itsource.feigenClients.UserFeignClient
 **/
@Component
public class UserFeignFallback implements FallbackFactory<UserFeignClient> {
    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public JSONResult findByPhone(String phone) {
                return JSONResult.error("搜索服务异常") ;
            }

            @Override
            public List<User> patchQuery(List<Long> ids) {
                return null;
            }

            @Override
            public JSONResult get(Long id) {
                return JSONResult.error("搜索服务异常") ;
            }
        };
    }



}
